package com.tedsoft.first_group_project;

import com.tedsoft.framework.Graphics;

public class Accel_meter
{
	final int MOTION_MARKER_ICON_WIDTH = 40;
	
	public int state;// -1 - lewo, 0 - nic, 1 - prawo;

	public Accel_meter()
	{
		state = 0;
	}
	
	public void update(float accel_y)
	{
		//kalibracja 
		float calibration_value = Settings.accel_Y_calibration_val;
		
		float val = accel_y - calibration_value;
		
		if(val <= -1)
			state = -1;
		else if(val >= 1)
			state = 1;
		else
			state = 0;
	}
	
	public void rysuj(Graphics g)
	{
		if (state == -1)
			g.drawPixmap(Assets.mark_slowedTime, (g.getWidth() - MOTION_MARKER_ICON_WIDTH)/2, 0);
		else if(state == 1)
			g.drawPixmap(Assets.mark_speedUp, (g.getWidth() - MOTION_MARKER_ICON_WIDTH)/2, 0);
		else
			g.drawPixmap(Assets.mark_normal, (g.getWidth() - MOTION_MARKER_ICON_WIDTH)/2, 0);
	}
}